package io.gitee.chearnee.fw.openapi.exception;

import io.gitee.chearnee.fw.openapi.constant.enums.ResultCode;

/**
 * @author cn
 * @version 1.0
 * @description
 * @date 2021/9/18 11:34
 */
public class OpenApiException extends RuntimeException {

  private final ResultCode resultCode;
  private final String message;

  //  private String innerMessage;
  public OpenApiException(String message) {
    this(ResultCode.FAILED, message);
  }

  public OpenApiException(ResultCode resultCode) {
    this(resultCode, resultCode.getDesc());
  }

  OpenApiException(ResultCode resultCode, String message) {
    super(message);
    this.message = message;
    this.resultCode = resultCode;
  }

  public ResultCode getResultCode() {
    return resultCode;
  }

  @Override
  public String getMessage() {
    return message;
  }
}
